
Program SkyPlot

! interaktivni kresleni mapek podobne gnuplotu

use interio
use BasePlot

integer narg
character(len=80) :: arg(10)
integer err,iddis
real(selected_real_kind(20)) :: ra,dec,r

write(*,*) 'Skyplot'
write(*,*) 'verze 0.0, 1998 cervenec-srpen, FH'
write(*,*) 
write(*,*) 'Ocekavam prikazy:   (zkus: help)'

!iddis = pgopen('/XWINDOW') 
!if( iddis <= 0 ) stop 'Error graphics operation.'
call PlotInit

do
  write(*,'(A)',advance='no') 'skyplot> '
  call readradek(narg,arg)
  if( arg(1)(1:4) == 'help' ) call help

! plot
  if( arg(1)(1:4) == 'plot' )then
    err = 0
    ra = num(arg(3),err)
    dec = num(arg(4),err)
    r = num(arg(5),err)
    if( err /= 0 ) then
       write(*,*) 'Skyplot: Spatny format vstupnich dat.'
    else
      call plot(arg(2),ra,dec,r)
    endif
  endif

! set
  if( arg(1)(1:3) == 'set' )then
    call set(arg)
  endif


! exit
  if( arg(1) == 'exit' .or. arg(1) == 'quit' .or. narg < 0 ) exit
enddo

!call pgslct(iddis)
!call pgclos

end

!-------------------------------------------------------------------------

subroutine help
! help

write(*,*) 'SkyPlot'
write(*,*) 'Experimentalni verze.'
write(*,*)
write(*,*) 'Prikazy:'
write(*,*) 'help ... zobrazi se tento help'
write(*,*) 'exit ... konec'
write(*,*) "plot 'soubor.dat' ra,dec radius ... kresli mapku"
write(*,*)
end

!subroutine plot(a,ra,dec,r)
!character(len=*) :: a
!real ra,dec,r
!
!print *,'kreslim mapku ',trim(a),ra,dec,r
!end 

subroutine set(par)
character(len=*) par(:)

print *,(trim(par(i)),i=2,size(par))
end




